Skip to content

runtime: single source of truth for embedded Node path/version#146

Merged
benvinegar merged 2 commits intomainfrom
runtime/node-source-of-truth-115
Feb 23, 2026
Merged

runtime: single source of truth for embedded Node path/version#146
benvinegar merged 2 commits intomainfrom
runtime/node-source-of-truth-115

Conversation

@benvinegar
Copy link
Copy Markdown
Member

@benvinegar benvinegar commented Feb 23, 2026

Summary

Implements #115 by removing hardcoded embedded Node version paths and introducing a canonical runtime locator with compatibility fallbacks.

What changed

  • Added bin/lib/runtime-node.sh as the single source for embedded Node resolution
    • canonical default version: 22.14.0
    • override via BAUDBOT_RUNTIME_NODE_VERSION
    • canonical runtime path: ~/opt/node/bin
    • fallback detection for existing ~/opt/node-v*-linux-x64/bin/node installs
  • Updated setup/install flow:
    • setup.sh now sources runtime helper and creates stable symlink ~/opt/node -> ~/opt/node-v<version>-linux-x64
    • install.sh + bin/baudbot now pass/preserve BAUDBOT_RUNTIME_NODE_VERSION
  • Updated runtime/ops scripts and service to consume canonical source instead of hardcoded version paths:
    • start.sh, bin/doctor.sh, bin/security-audit.sh, bin/baudbot, bin/lib/baudbot-runtime.sh, bin/baudbot.service
    • CI scripts: bin/ci/setup-ubuntu.sh, bin/ci/setup-arch.sh
    • control-agent docs/scripts: pi/skills/control-agent/SKILL.md, pi/skills/control-agent/startup-cleanup.sh
  • Added drift guard:
    • new test bin/runtime-node-paths.test.sh fails on versioned path literals (node-vX.Y.Z-linux-x64)
    • wired into test/shell-scripts.test.mjs
    • bin/doctor.sh now reports path drift
  • Updated config docs (CONFIGURATION.md) with BAUDBOT_RUNTIME_NODE_VERSION
  • Updated deploy staging to include bin/lib/runtime-node.sh in runtime (~/runtime/bin/lib/runtime-node.sh)

Validation

  • Local: npm run test:shell
  • Droplet validation using DO keys (DO_API_TOKEN) and CI scripts:
    • Ubuntu (bin/ci/setup-ubuntu.sh) ✅
    • Arch (bin/ci/setup-arch.sh) ✅
    • both completed full smoke + bin/test.sh suites successfully

Closes #115

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Feb 23, 2026

Greptile Summary

Centralizes embedded Node.js runtime path resolution by introducing bin/lib/runtime-node.sh as the single source of truth. All hardcoded version paths (node-v22.14.0-linux-x64) replaced with dynamic resolution via helper functions that use a stable symlink (~/opt/node).

Key improvements:

  • New bb_runtime_node_version(), bb_runtime_node_bin_dir(), and bb_resolve_runtime_node_bin() functions provide canonical runtime discovery
  • Setup now creates stable symlink ~/opt/node -> ~/opt/node-v<version>-linux-x64
  • Environment variable BAUDBOT_RUNTIME_NODE_VERSION enables version override
  • Drift guard test (bin/runtime-node-paths.test.sh) prevents future hardcoded paths
  • All 18 files updated consistently: setup, install, CLI, service, runtime scripts, CI, and docs
  • bin/doctor.sh reports path drift detection
  • New bin/ci/smoke-cli.sh added for comprehensive CLI validation

Confidence Score: 5/5

  • Safe to merge - comprehensive refactoring with excellent test coverage and validation
  • Implementation is thorough and well-architected. The PR introduces a clean abstraction layer with robust fallback logic, comprehensive test coverage (drift guard + smoke tests), and has been validated on both Ubuntu and Arch droplets. All 18 files updated consistently without leaving hardcoded references. The approach maintains backward compatibility through fallback detection of existing versioned installs.
  • No files require special attention

Important Files Changed

Filename Overview
bin/lib/runtime-node.sh New module providing centralized Node runtime path resolution with fallback logic
bin/runtime-node-paths.test.sh Drift guard test preventing hardcoded versioned Node paths in codebase
setup.sh Updated to use runtime helper, creates stable symlink ~/opt/node
bin/baudbot Integrated runtime locator, preserves BAUDBOT_RUNTIME_NODE_VERSION env var
start.sh Migrated from hardcoded path to runtime helper for Node bin directory
bin/doctor.sh Uses runtime resolver and reports path drift detection in diagnostics
bin/deploy.sh Deploys runtime-node.sh to ~/runtime/bin/lib/ for production use

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[bin/lib/runtime-node.sh] -->|sources| B[setup.sh]
    A -->|sources| C[bin/baudbot]
    A -->|sources| D[start.sh]
    A -->|sources| E[bin/doctor.sh]
    A -->|sources| F[bin/lib/baudbot-runtime.sh]
    A -->|sources| G[bin/security-audit.sh]
    
    B -->|creates symlink| H[~/opt/node -> ~/opt/node-v22.14.0-linux-x64]
    B -->|uses| I[bb_runtime_node_version]
    B -->|uses| J[bb_runtime_node_bin_dir]
    
    C -->|preserves| K[BAUDBOT_RUNTIME_NODE_VERSION]
    C -->|calls| L[bb_resolve_runtime_node_bin]
    
    D -->|calls| M[bb_resolve_runtime_node_bin_dir]
    E -->|calls| L
    E -->|checks| N[runtime path drift]
    
    O[bin/runtime-node-paths.test.sh] -->|prevents| P[hardcoded versioned paths]
    O -->|integrated in| Q[test/shell-scripts.test.mjs]
    
    R[install.sh] -->|passes env to| B
    
    S[bin/deploy.sh] -->|deploys| A
    S -->|to| T[~/runtime/bin/lib/runtime-node.sh]
Loading

Last reviewed commit: ede5635

Comment thread setup.sh Outdated
@benvinegar benvinegar force-pushed the runtime/node-source-of-truth-115 branch from ede5635 to 22d2177 Compare February 23, 2026 20:18
@benvinegar benvinegar merged commit eaf7fd0 into main Feb 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runtime: single source of truth for embedded Node path/version

1 participant